<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>CSS01 | 静待花开</title><meta name="author" content="brad 随风起舞"><meta name="copyright" content="brad 随风起舞"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="CSS基础编写规则h1 &#123; color: green; &#125;  p &#123; font-size: large; font-family: sans-serif; &#125;  第一条语句选择所有h1标签,使其样式颜色变为绿色 第二条语句选择所有P标签,改变字体大小,字体. 选择标签写在大括号外,属性之间分号隔离,属性key和值之间用:分割. 属性体写在大括号内. 优先级如">
<meta property="og:type" content="article">
<meta property="og:title" content="CSS01">
<meta property="og:url" content="https://zhangbo4881820.gitee.io/myblog/posts/20082/index.html">
<meta property="og:site_name" content="静待花开">
<meta property="og:description" content="CSS基础编写规则h1 &#123; color: green; &#125;  p &#123; font-size: large; font-family: sans-serif; &#125;  第一条语句选择所有h1标签,使其样式颜色变为绿色 第二条语句选择所有P标签,改变字体大小,字体. 选择标签写在大括号外,属性之间分号隔离,属性key和值之间用:分割. 属性体写在大括号内. 优先级如">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:published_time" content="2019-12-16T03:13:11.000Z">
<meta property="article:modified_time" content="2023-09-07T09:44:01.907Z">
<meta property="article:author" content="brad 随风起舞">
<meta property="article:tag" content="前端知识">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="/myblog/img/favicon.png"><link rel="canonical" href="https://zhangbo4881820.gitee.io/myblog/posts/20082/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/myblog/css/index.css"><link rel="stylesheet" href="/myblog/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/myblog/css/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/myblog/',
  algolia: undefined,
  localSearch: {"path":"/myblog/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'CSS01',
  isPost: true,
  isHome: false,
  isHighlightShrink: true,
  isToc: true,
  postUpdate: '2023-09-07 17:44:01'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 7.0.0-rc2"><link rel="alternate" href="/myblog/atom.xml" title="静待花开" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/myblog/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/myblog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a><a href="/myblog/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/myblog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分享</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/myblog/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/myblog/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/myblog/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/myblog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog-info"><a href="/myblog/" title="静待花开"><span class="site-name">静待花开</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/myblog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分享</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/myblog/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></li><li><a class="site-page child" href="/myblog/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/myblog/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/myblog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/myblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div id="post"><div id="post-info"><h1 class="post-title">CSS01</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-12-16T03:13:11.000Z" title="发表于 2019-12-16 11:13:11">2019-12-16</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-09-07T09:44:01.907Z" title="更新于 2023-09-07 17:44:01">2023-09-07</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/myblog/categories/CSS/">CSS</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="CSS01"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div><article class="post-content" id="article-container"><h1 id="CSS基础"><a href="#CSS基础" class="headerlink" title="CSS基础"></a>CSS基础</h1><h2 id="编写规则"><a href="#编写规则" class="headerlink" title="编写规则"></a>编写规则</h2><pre><code>h1 &#123; color: green; &#125; 
p &#123; font-size: large; font-family: sans-serif; &#125;
</code></pre>
<p>第一条语句选择所有h1标签,使其样式颜色变为绿色</p>
<p>第二条语句选择所有P标签,改变字体大小,字体.</p>
<p>选择标签写在大括号外,属性之间分号隔离,属性key和值之间用<code>:</code>分割. 属性体写在大括号内.</p>
<h2 id="优先级"><a href="#优先级" class="headerlink" title="优先级"></a>优先级</h2><p>如果你没有写任何的样式代码,那么web页会继承浏览器的内部样式.我们称为默认渲染.</p>
<p>优先级从高到低如下:</p>
<ol>
<li><p>用户读者的导入<strong>important</strong></p>
</li>
<li><p>开发者的导入<strong>important</strong></p>
</li>
<li><p>开发者复写的</p>
</li>
<li><p>用户读者复写的</p>
</li>
<li><p>浏览器默认的</p>
</li>
</ol>
<h2 id="选择器决定冲突胜出者"><a href="#选择器决定冲突胜出者" class="headerlink" title="选择器决定冲突胜出者"></a>选择器决定冲突胜出者</h2><p>在两个样式冲突的规则中,选择器指定的越明确的将会胜出.</p>
<p>如果你不想CSS被覆盖,那么你可以加入<code>!importance</code>如下:</p>
<pre><code>p &#123;color: blue !important;&#125;
</code></pre>
<p>这样的话,在开发者样式级别下无法被覆盖.但是用户级别下可以用<code>!important</code>覆盖该语句</p>
<h2 id="规则顺序"><a href="#规则顺序" class="headerlink" title="规则顺序"></a>规则顺序</h2><p>基本就是最后的那个胜出!</p>
<pre><code>&lt;style&gt; 
p &#123; color: red; &#125; 
p &#123; color: blue; &#125; 
p &#123; color: green; &#125; 
&lt;/style&gt;
</code></pre>
<p>上面这个例子就是P会变成绿色的.</p>
<h2 id="组选择"><a href="#组选择" class="headerlink" title="组选择"></a>组选择</h2><pre><code>h1, h2, p, em, img &#123; border: 1px solid blue; &#125;
</code></pre>
<h2 id="CSS单位"><a href="#CSS单位" class="headerlink" title="CSS单位"></a>CSS单位</h2><p>分为绝对和相对单位:</p>
<p><span><font color="7E7F82">绝对单位</font></span></p>
<p>就是和真实世界单位一个意思.像素除外.具有如下单位</p>
<table width="100%">
    <tr>
        <td>px</td>
        <td>in</td>
        <td>mm</td>
        <td>cm</td>
        <td>q</td>
        <td>pt</td>
        <td>pc</td>
    </tr>
    <tr>
        <td>像素</td>
        <td>英寸</td>
        <td>毫米</td>
        <td>厘米</td>
        <td>四分之一毫米</td>
        <td>点,1/72英寸</td>
        <td>picas,1/6英寸</td>
    </tr>
</table>


<p><span><font color="7E7F82">相对单位</font></span></p>
<p>相对单位基于一些其他大小的单位,例如父元素大小.</p>
<table width="100%">
    <tr>
        <td>em</td>
        <td>ex</td>
        <td>rem</td>
        <td>ch</td>
        <td>vw</td>
        <td>vh</td>
        <td>vmin</td>
        <td>vmax</td>
    </tr>
    <tr>
        <td>等于当前字体大小单位</td>
        <td>x-高,相当于小写`x`的高</td>
        <td>等于根元素的em大小</td>
        <td>零宽度，等于当前字体和大小中的零（0）宽度。</td>
        <td>视口宽度单位，等于当前视口（浏览器窗口）宽度的1/100。</td>
        <td>视口高度单位，等于当前视口高度的1/100</td>
        <td>视口最小单位，等于vw或vh的值，以较小者为准。</td>
        <td>视口最大单位，等于vw或vh的值，以较大者为准。</td>
    </tr>
</table>

<h1 id="文本格式样式"><a href="#文本格式样式" class="headerlink" title="文本格式样式"></a>文本格式样式</h1><h2 id="基本的font属性"><a href="#基本的font属性" class="headerlink" title="基本的font属性"></a>基本的font属性</h2><p>一个字拥有的属性列出如下</p>
<ol>
<li><p><strong>values:</strong><br>接受一个值的属性.</p>
</li>
<li><p><strong>default:</strong><br>默认值</p>
</li>
<li><p><strong>Applies to:</strong><br>一些属性只应用在指定元素类型上</p>
</li>
<li><p><strong>Inherits:</strong><br>这表示属性是否传递到元素的后代元素上</p>
</li>
</ol>
<p><strong>css扩展关键字:</strong><br>所有的css属性都接受三个CSS扩展关键字:</p>
<ol>
<li><p><strong>initial:</strong> 这个关键字明确指出设置属性的默认值</p>
</li>
<li><p>**inherit:**这可以明确指定强制让一个元素从其父元素继承其样式</p>
</li>
<li><p>**unset:**是清除早先在CSS中声明的值.</p>
</li>
</ol>
<h2 id="指定字体名字"><a href="#指定字体名字" class="headerlink" title="指定字体名字"></a>指定字体名字</h2><p>使用<font color="F9AF57">font-family</font>属性.</p>
<p>Values: 一个或多个字体名字,用逗号隔开<br>Default: depends on the browser<br>Applies to: all elements<br>Inherits: yes</p>
<pre><code>body &#123; font-family: Arial; &#125; 
var &#123; font-family: Courier, monospace; &#125; 
p &#123; font-family: &quot;Duru Sans&quot;, Verdana, sans-serif; &#125;
</code></pre>
<ul>
<li><p>除通用字体系列外，所有字体名称都必须大写。例如，使用Arial代替arial</p>
</li>
<li><p>使用逗号分割多个字体</p>
</li>
<li><p>如果一个字体之间存在空格那么这个字体要用引号括起来</p>
</li>
</ul>
<h2 id="指定字体大小"><a href="#指定字体大小" class="headerlink" title="指定字体大小"></a>指定字体大小</h2><p>使用<font color="F9AF57">font-size</font>属性.</p>
<p>Values: length unit | percentage | xx-small | x-small | small | medium | large | x-large | xx-large | smaller | larger Default: medium<br>Applies to: all elements<br>Inherits: yes</p>
<ol>
<li><p>使用css长度单位</p>
<pre><code> h1 &#123; font-size: 1.5em; &#125;
</code></pre>
</li>
<li><p>以百分比值的形式，从元素的继承字体大小开始增大或减小：</p>
<pre><code> h1 &#123; font-size: 150%; &#125;
</code></pre>
</li>
<li><p>使用绝对关键字之一(xx-small, x-small, small, medium, large, x-large, xx-large).</p>
<pre><code> h1 &#123; font-size: x-large; &#125;
</code></pre>
</li>
<li><p>使用相对关键字（更大或更小）来微调大于或小于周围文本的文本</p>
<pre><code> strong &#123; font-size: larger; &#125;
</code></pre>
</li>
</ol>
<p><img src="/myblog/image/wordkeydisplay.png"></p>
<h2 id="字体粗细"><a href="#字体粗细" class="headerlink" title="字体粗细"></a>字体粗细</h2><p>使用<font color="F9AF57">font-weight</font>属性.</p>
<p>Values: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900<br>Default: normal<br>Applies to: all elements<br>Inherits: yes</p>
<p><img src="/myblog/image/font-weight-display.png"></p>
<h2 id="字体样式"><a href="#字体样式" class="headerlink" title="字体样式"></a>字体样式</h2><p>使用<font color="F9AF57">font-style</font>属性.</p>
<p>Values: normal | italic | oblique (斜体)<br>Default: normal<br>Applies to: all elements<br>Inherits: yes</p>
<h2 id="字体变体"><a href="#字体变体" class="headerlink" title="字体变体"></a>字体变体</h2><p>在<code>CSS2.1</code>版本中的属性<br>使用<font color="F9AF57">font-variant</font>属性.</p>
<p>Values: normal | small-caps<br>Default: normal<br>Applies to: all elements<br>Inherits: yes</p>
<p>这个作用就是让字母全部是大学,并且字母尺寸大后面字母尺寸小.但是都是大写</p>
<h2 id="字体拉伸"><a href="#字体拉伸" class="headerlink" title="字体拉伸"></a>字体拉伸</h2><p>使用<font color="F9AF57">font-Stretch</font>属性.</p>
<p>Values: normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded<br>Default: normal<br>Applies to: all elements<br>Inherits: yes</p>
<p><img src="/myblog/image/stratchfont.png"></p>
<h2 id="快捷字体属性"><a href="#快捷字体属性" class="headerlink" title="快捷字体属性"></a>快捷字体属性</h2><p>使用<font color="F9AF57">font</font>属性.</p>
<p>Values: font-style font-weight font-variant font-stretch font-size&#x2F;line-height font-family | caption | icon | menu | message-box | small-caption | status-bar<br>Default: depends on default value for each property listed<br>Applies to: all elements<br>Inherits: yes</p>
<p>在这个属性中,各个属性的顺序是非常重要的:</p>
<pre><code>&#123; font: style weight stretch variant size/line-height font-family; &#125;
</code></pre>
<p>如果使用了后面的属性,比如size那么后面就只能接font-family属性了</p>
<h2 id="字体颜色"><a href="#字体颜色" class="headerlink" title="字体颜色"></a>字体颜色</h2><p>使用<font color="F9AF57">color</font>属性.</p>
<p>Values: color value (name or numeric)<br>Default: depends on the browser and user’s preferences<br>Applies to: all elements<br>Inherits: yes</p>
<pre><code>h1 &#123; color: gray; &#125; 
h1 &#123; color: #666666; &#125; 
h1 &#123; color: #666; &#125; 
h1 &#123; color: rgb(102,102,102); &#125;
</code></pre>
<p>CSS2.1 定义了17个标准颜色名字: <font color="black">black</font> <span style="margin: 1px solid black;background: black;"><font color="white">white</font></span> <font color="purple">purple</font> <font color="lime">lime</font> <font color="navy">navy</font> <font color="aqua">aqua</font> <font color="silver">silver</font> <font color="maroon">maroon</font> <font color="fuchsia">fuchsia</font> <font color="olive">olive</font> <font color="blue">blue</font> <font color="orange">orange</font> <font color="gray">gray</font> <font color="red">red</font> <font color="green">green</font> <font color="yellow">yellow</font> <font color="teal">teal</font></p>
<h2 id="选择类型"><a href="#选择类型" class="headerlink" title="选择类型"></a>选择类型</h2><ol>
<li><p>元素选择:</p>
<pre><code> p &#123; color: navy; &#125;
</code></pre>
</li>
<li><p>组选择</p>
<pre><code> p, ul, td, th &#123; color: navy; &#125;
</code></pre>
</li>
<li><p>后代选择</p>
<pre><code> li em &#123; color: olive; &#125;
</code></pre>
</li>
<li><p>ID选择</p>
<pre><code> &lt;li id=&quot;sleestak&quot;&gt;Sleestak T-shirt&lt;/li&gt;
 #sleestak &#123; color: olive; &#125;
</code></pre>
</li>
<li><p>子选择(本例意思只有在p元素下面有em元素,且em元素的上一个元素只能是p元素)</p>
<pre><code> p &gt; em &#123;font-weight: bold;&#125;
</code></pre>
</li>
<li><p>下一个兄弟选择(就是有相同的父元素,且是前一个元素之后的元素)</p>
<pre><code> h1 + p &#123;font-style: italic;&#125;
</code></pre>
</li>
<li><p>类选择</p>
<pre><code> .special &#123; color: orange; &#125;
</code></pre>
</li>
</ol>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://zhangbo4881820.gitee.io/myblog">brad 随风起舞</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://zhangbo4881820.gitee.io/myblog/posts/20082/">https://zhangbo4881820.gitee.io/myblog/posts/20082/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://zhangbo4881820.gitee.io/myblog" target="_blank">静待花开</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/myblog/tags/%E5%89%8D%E7%AB%AF%E7%9F%A5%E8%AF%86/">前端知识</a></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/myblog/posts/46420/" title="docker结构"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">docker结构</div></div></a></div><div class="next-post pull-right"><a href="/myblog/posts/44091/" title="nginx小操作"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">nginx小操作</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/myblog/posts/63260/" title="JQuery"><div class="cover" style="background: var(--default-bg-color)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-10-12</div><div class="title">JQuery</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/myblog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">brad 随风起舞</div><div class="author-info__description">有些事情需要一辈子的沉淀</div></div><div class="card-info-data site-data is-center"><a href="/myblog/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/myblog/tags/"><div class="headline">标签</div><div class="length-num">20</div></a><a href="/myblog/categories/"><div class="headline">分类</div><div class="length-num">25</div></a></div><a id="card-info-btn" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/xxxxx" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:xxxxxx@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#CSS%E5%9F%BA%E7%A1%80"><span class="toc-number">1.</span> <span class="toc-text">CSS基础</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E5%86%99%E8%A7%84%E5%88%99"><span class="toc-number">1.1.</span> <span class="toc-text">编写规则</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%98%E5%85%88%E7%BA%A7"><span class="toc-number">1.2.</span> <span class="toc-text">优先级</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%80%89%E6%8B%A9%E5%99%A8%E5%86%B3%E5%AE%9A%E5%86%B2%E7%AA%81%E8%83%9C%E5%87%BA%E8%80%85"><span class="toc-number">1.3.</span> <span class="toc-text">选择器决定冲突胜出者</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%A7%84%E5%88%99%E9%A1%BA%E5%BA%8F"><span class="toc-number">1.4.</span> <span class="toc-text">规则顺序</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BB%84%E9%80%89%E6%8B%A9"><span class="toc-number">1.5.</span> <span class="toc-text">组选择</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#CSS%E5%8D%95%E4%BD%8D"><span class="toc-number">1.6.</span> <span class="toc-text">CSS单位</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%96%87%E6%9C%AC%E6%A0%BC%E5%BC%8F%E6%A0%B7%E5%BC%8F"><span class="toc-number">2.</span> <span class="toc-text">文本格式样式</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E7%9A%84font%E5%B1%9E%E6%80%A7"><span class="toc-number">2.1.</span> <span class="toc-text">基本的font属性</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8C%87%E5%AE%9A%E5%AD%97%E4%BD%93%E5%90%8D%E5%AD%97"><span class="toc-number">2.2.</span> <span class="toc-text">指定字体名字</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8C%87%E5%AE%9A%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F"><span class="toc-number">2.3.</span> <span class="toc-text">指定字体大小</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E4%BD%93%E7%B2%97%E7%BB%86"><span class="toc-number">2.4.</span> <span class="toc-text">字体粗细</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E4%BD%93%E6%A0%B7%E5%BC%8F"><span class="toc-number">2.5.</span> <span class="toc-text">字体样式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E4%BD%93%E5%8F%98%E4%BD%93"><span class="toc-number">2.6.</span> <span class="toc-text">字体变体</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E4%BD%93%E6%8B%89%E4%BC%B8"><span class="toc-number">2.7.</span> <span class="toc-text">字体拉伸</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BF%AB%E6%8D%B7%E5%AD%97%E4%BD%93%E5%B1%9E%E6%80%A7"><span class="toc-number">2.8.</span> <span class="toc-text">快捷字体属性</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E4%BD%93%E9%A2%9C%E8%89%B2"><span class="toc-number">2.9.</span> <span class="toc-text">字体颜色</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%80%89%E6%8B%A9%E7%B1%BB%E5%9E%8B"><span class="toc-number">2.10.</span> <span class="toc-text">选择类型</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/15695/" title="jenkins（1）">jenkins（1）</a><time datetime="2023-09-14T02:17:44.000Z" title="发表于 2023-09-14 10:17:44">2023-09-14</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/22012/" title="wsl的Ubuntu子系统（1）">wsl的Ubuntu子系统（1）</a><time datetime="2023-09-13T08:42:19.000Z" title="发表于 2023-09-13 16:42:19">2023-09-13</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/30302/" title="effective-java-(接口优于抽象类)">effective-java-(接口优于抽象类)</a><time datetime="2023-09-12T08:12:48.000Z" title="发表于 2023-09-12 16:12:48">2023-09-12</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/9473/" title="effective-java(创建和销毁对象--组合的形式优于继承)">effective-java(创建和销毁对象--组合的形式优于继承)</a><time datetime="2023-09-11T08:23:19.000Z" title="发表于 2023-09-11 16:23:19">2023-09-11</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/myblog/posts/16107/" title="Hello World">Hello World</a><time datetime="2023-09-07T09:44:01.910Z" title="发表于 2023-09-07 17:44:01">2023-09-07</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By brad 随风起舞</div><div class="framework-info"><span>框架 </span><a href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/myblog/js/utils.js"></script><script src="/myblog/js/main.js"></script><script src="/myblog/js/fancybox.umd.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/myblog/js/search/local-search.js"></script></div></div></body></html>